(function($){
    $.fn.pathrule = function() {
        return this.data("pathrule") || new $.fn.pathrule._create(this);
    }

    $.fn.pathrule._create = function($element) {
        this.element = $element;
        this.element.change(function() {
            //删除原有的绑定
//            $.post("",{},function() {
//
//            });
            $(this).pathrule()._delrule();
            $(this).pathrule()._rules = [{page_id:"",bind_id:"",dom_id:"button2",type:"",default:{key:'',value:$(this).val() + "qiang"},readonly:true,range:[]}];
            $(this).pathrule()._serialize();

            //添加绑定事件
            $(this).pathrule()._addrule();
        })
        this._serialize();
    }

    $.fn.pathrule._serialize = function() {
        this.element.data("pathrule",this);
    }

    $.fn.pathrule._addrule = function() {
        $.each(this._rules,function() {
            $("#" + this.dom_id).val(this.default.value);
            $("#" + this.dom_id).attr("readonly","readonly");
        });
    }

    $.fn.pathrule._delrule = function() {

    }

    $.fn.pathrule._create.prototype = $.fn.pathrule;
})(jQuery)